package mmoon.mmoonstory.eventhandler;

import mmoon.mmoonstory.MMoonConfig;
import mmoon.mmoonstory.MMoonStory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

import java.util.List;

@Mod.EventBusSubscriber(modid = MMoonStory.MOD_ID)
public class EventBlock {

    @SubscribeEvent
    public static void onHarvestDrops(BlockEvent.HarvestDropsEvent event) {
        List<ItemStack> drops = event.getDrops();
        for (String i : MMoonConfig.ADDITIONAL_DROP_LIST) {
            Item item = Item.getByNameOrId(i);
            if (item != null) {
                drops.add(new ItemStack(item));
            }
        }
    }
}
